﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EntModApp.EntServices.Data
{
  public abstract class SimpleFilterExpression<T>
  {
  }

  public abstract class OneOperandFilterExpression<T> :
    SimpleFilterExpression<T>
  {
    public OneOperandFilterExpression() { }
    public OneOperandFilterExpression(T operand)
    {
      Operand = operand;
    }
    public T Operand { get; set; }
  }

  public abstract class TwoOperandFilterExpression<T> :
    SimpleFilterExpression<T>
  {
    public TwoOperandFilterExpression() { }
    public TwoOperandFilterExpression(T operand1, T operand2)
    {
      Operand1 = operand1;
      Operand2 = operand2;
    }
    public T Operand1 { get; set; }
    public T Operand2 { get; set; }
  }

  public enum ComparisonFilterOperation
  {
    Equals,
    NotEqual,
    LessThan,
    LessThanOrEqualsTo,
    GreaterThan,
    GreaterThanOrEqualsTo,
  }

  public enum StringFilterOperation
  {
    StartsWith,
    EndsWith,
    Contains,
  }

  public class SimpleComparisonFilterExpression<T> :
    OneOperandFilterExpression<T>
  {
    public SimpleComparisonFilterExpression() { }
    public SimpleComparisonFilterExpression(T operand, ComparisonFilterOperation operation)
      : base(operand)
    {
      Operation = operation;
    }
    public ComparisonFilterOperation Operation { get; set; }
  }

  public class SimpleStringFilterExpression :
    OneOperandFilterExpression<string>
  {
    public SimpleStringFilterExpression() { }
    public SimpleStringFilterExpression(string operand, StringFilterOperation operation)
      : base(operand)
    {
      Operation = operation;
    }
    public StringFilterOperation Operation { get; set; }
  }

  public class BetweenValuesFilterExpression<T> :
    TwoOperandFilterExpression<T>
  {
    public BetweenValuesFilterExpression() { }
    public BetweenValuesFilterExpression(T operand1, T operand2, bool include1, bool include2)
      : base(operand1, operand2)
    {
      Include1 = include1;
      Include2 = include2;
    }
    public bool Include1 { get; set; }
    public bool Include2 { get; set; }
  }

}
